package com.jason.seckill.controller;


import com.jason.seckill.exception.GlobalException;
import com.jason.seckill.pojo.Order;
import com.jason.seckill.pojo.User;
import com.jason.seckill.service.IOrderService;
import com.jason.seckill.vo.GoodsVo;
import com.jason.seckill.vo.OrderDetailVo;
import com.jason.seckill.vo.RespBean;
import com.jason.seckill.vo.RespBeanEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author jason
 * @since 2021-10-23
 */
@Controller
@RequestMapping("/order")
public class OrderController {

    @Autowired
    IOrderService orderService;

    @GetMapping("/detail")
    @ResponseBody
    private RespBean detail(User user, Long orderId) {
        if (null==user){
         return RespBean.error(RespBeanEnum.SESSION_ERROR);
     }
      OrderDetailVo detail = orderService.detail(orderId);
      return RespBean.success(detail);
    }
}
